package com.ctrl.riveradministrator.mvp.view.activity.river_info;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Message;
import android.support.annotation.RequiresApi;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.ctrl.riveradministrator.R;
import com.ctrl.riveradministrator.base.BaseFragment;
import com.ctrl.riveradministrator.base.BaseListAdapter;
import com.ctrl.riveradministrator.mvp.model.RiverInfo;
import com.ctrl.riveradministrator.mvp.presenter.RiverInfoPresenter;
import com.ctrl.riveradministrator.mvp.view.activity.river_doc.RiverDocActivity;
import com.ctrl.riveradministrator.mvp.view.activity.river_policy.RiverPolicyActivity;
import com.ctrl.riveradministrator.mvp.view.weight.BottomDialog;

import java.util.List;

// TODO: 2019/5/17 未完成加载
public class RiverInfoFragment extends BaseFragment<RiverInfoPresenter> implements RiverInfoView {

    public static RiverInfoFragment INSTANCE;


    private RiverInfo riverInfo;
    private TextView name, ly, sx, hllb, hldj, hllx, hlab, hlcd, hydm, hkdm;

    public RiverInfoFragment() {

    }

    public static RiverInfoFragment newInstance() {
        if (INSTANCE == null) {
            INSTANCE = new RiverInfoFragment();
        }
        return INSTANCE;
    }


    @Override
    protected int bindLayout() {
        return R.layout.fragment_river_info;
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void initView(View view) {
        this.riverInfo = RiverDocActivity.riverInfo;

        name = $(view, R.id.name);
        ly = $(view, R.id.ly);
        sx = $(view, R.id.sx);
        hllb = $(view, R.id.hllb);
        hldj = $(view, R.id.hldj);
        hllx = $(view, R.id.hllx);
        hlab = $(view, R.id.hlab);
        hlcd = $(view, R.id.hlcd);
        hydm = $(view, R.id.hydm);
        hkdm = $(view, R.id.hkdm);

        name.setText(riverInfo.getRiverName());
        ly.setText(riverInfo.getBasinName());
        sx.setText(riverInfo.getWaterSystemName());
        hllb.setText(riverInfo.getCategoryName());
        hldj.setText(riverInfo.getGradeName());
        hllx.setText(riverInfo.getTypeName());
        hlab.setText(riverInfo.getShoreSeparationName());
        hlcd.setText(riverInfo.getRiverLength());
        hydm.setText(riverInfo.getRiverAreaName());
        hkdm.setText(riverInfo.getEstuaryAreaName());
    }

    @Override
    protected void doBusiness(Context mContext, Activity activity) {
        mPresenter.getRiverPolicy("0", "20");
    }

    @Override
    protected void widgetClick(View view) {
        switch (view.getId()) {

        }
    }

    @Override
    protected void setListener() {

    }

    @Override
    public void handleMessage(Message message, int what) {

    }

    @Override
    public void showMessage(List<RiverInfo> riverPolicies) {

    }

    @Override
    protected RiverInfoPresenter createPresenter() {
        return new RiverInfoPresenter(this);
    }

}
